﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Vds2465Telegrams
{
	public enum eTransportServiceType
	{
		/// <summary>
		/// 0x10, Analoge Festverbindung
		/// </summary>
		AnalogFixedConnection,

		/// <summary>
		/// 0x20, Analoge Bedarfsgesteuerte Verbindung
		/// </summary>
		AnalogDynamicConnection,

		/// <summary>
		/// 0x30, X.25 bzw. Datex-P
		/// </summary>
		X25_DatexP,

		/// <summary>
		/// 0x40, ISDN B-Kanal
		/// </summary>
		ISDN_B_Channel,

		/// <summary>
		/// 0x50, ISDN D-Kanal
		/// </summary>
		ISDN_D_Channel,

		/// <summary>
		/// 0x60, Bündelfunk - Betriebsfunk
		/// </summary>
		Trunking,

		/// <summary>
		/// 0x70, Datenfunk
		/// </summary>
		RadioDataTransmission,

		/// <summary>
		/// 0x80, Mobilfunk
		/// </summary>
		MobileRadioCommunication,

		/// <summary>
		/// 0x90, TCP/IP-Intranet-Übertragung
		/// </summary>
		TCP_IP_Intranet,
	}

	public class UserData_61_TransportServiceType : UserData
	{
		#region private member variables

		private readonly eTransportServiceType _transportServiceType;
		
		#endregion private member variables

		#region constructor

		public UserData_61_TransportServiceType(eTransportServiceType transportServiceType)
            : base(UserData.UserData61TransportServiceType)
		{
			_transportServiceType = transportServiceType;
		}

		#endregion constructor

		#region getters

		public eTransportServiceType TransportServiceType { get { return _transportServiceType; } }

		#endregion getters

		#region ToString, Equals, GetHashCode

		public override int GetHashCode()
		{
			int hashCode = base.GetHashCode();
			hashCode ^= (byte)_transportServiceType;

			return hashCode;
		}

		public override string ToString()
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append("(");
			stringBuilder.Append(ToStringProperties());
			stringBuilder.Append(")");

			return stringBuilder.ToString();
		}

		internal override string ToStringProperties()
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append(base.ToStringProperties());
			stringBuilder.Append(", ");

			stringBuilder.Append("TransportServiceType='");
			stringBuilder.Append(TransportServiceType);
			stringBuilder.Append("'");
			return stringBuilder.ToString();
		}

		public override bool Equals(object obj)
		{
			Type objType = obj.GetType();
			if (this.GetType() == objType)
			{
				UserData_61_TransportServiceType userData2Compare = obj as UserData_61_TransportServiceType;
                return EqualsProperties(userData2Compare);
			}

			return false;
		}

		internal bool EqualsProperties(UserData_61_TransportServiceType userData2Compare)
		{
            if (base.EqualsProperties(userData2Compare))
			{
				return (TransportServiceType == userData2Compare.TransportServiceType);
			}

			return false;
		}		

		#endregion ToString, Equals, GetHashCode
	}
}
